#include <QFileDialog>
#include "pocketrefinecontrol.h"

using namespace PBVP;

PocketRefineControl::PocketRefineControl(FileExtensionManager *pFileExtManager, QWidget *parent)
	: QDialog(parent)
{
	m_pFileExtManager = pFileExtManager;
	ui.setupUi(this);

	connect(ui.browsePocket, SIGNAL(pressed()), this, SLOT(setPocketFile()));
	connect(ui.browseProtein, SIGNAL(pressed()), this, SLOT(setProteinFile()));
}

PocketRefineControl::~PocketRefineControl()
{

}


/////////////////////////////////////////////////////////////////
/// SLOTS
/////////////////////////////////////////////////////////////////
void PocketRefineControl::setPocketFile()
{
	QString fname = QFileDialog::getOpenFileName(this, "Open Pocket Surface", "", 
		m_pFileExtManager->filter(GEOMETRY_DATA));	
	if (!fname.isNull()) {
		ui.pocketFile->setText(fname);
	}
}

void PocketRefineControl::setProteinFile()
{
	QString fname = QFileDialog::getOpenFileName(this, "Open Protein Surface", "", 
		m_pFileExtManager->filter(GEOMETRY_DATA));	
	if (!fname.isNull()) {
		ui.proteinFile->setText(fname);
	}
}